package com.focusit.plurarization;


public class FullWordForm implements WordForm {
    String[] wordForms = { null, null, null, null };

    public FullWordForm(String one, String few, String many, String other) {
        wordForms[0] = one;
        wordForms[1] = few;
        wordForms[2] = many;
        wordForms[3] = other;
    }

    public FullWordForm(String formString) {
        String[] forms = formString.split(",");

        for (int i = 0; i < forms.length; i++) {
            String trimmed = forms[i].trim();
            wordForms[i] = trimmed.length() > 0 ? trimmed : null;
        }
    }

    public String getWordInForm(PluralForm form) {
        switch (form) {
        case one:
            return wordForms[0];
        case few:
            return wordForms[1];
        case many:
            return wordForms[2];
        case other:
            return wordForms[3];
        }
        return null;
    }

}
